<template>
    <div class="platform-page page">
        <img width="100%" src="/images/coach_training_banner.jpg"/>
        <div class="content">
            <PlatformCrumb back="返回" style="margin-top: 0;">
            </PlatformCrumb>
            <div class="content event-detail">
                <div class="qy_detailbody">
                    <div class="qy_detailbodytitle">
                        <span>基本资料</span>
                    </div>
<!--                    机构基本信息-->
                    <div class="qy_detailbody1 jgjbzl">
                        <img class="qiuyuanimg" :src="jgdetail.logoImg|filtersImg" alt="">
                        <div class="qy_detailbody1z">
                            <h3>{{jgdetail.name}}</h3>
                            <p><img src="../../assets/icon1.png" alt="">负责人：{{jgdetail.leaderName}}</p>
                            <p><img src="../../assets/icon1.png" alt="">联系电话：{{jgdetail.leaderPhone}}</p>
                            <p><img src="../../assets/weixin.png" alt="">微信：{{jgdetail.weChatNo}}</p>
                            <p><img src="../../assets/youxiang.png" alt="">邮箱：{{jgdetail.mail}}</p>
                            <p><img src="../../assets/zhengjian.png" alt="">证件号码：{{jgdetail.leaderNo}}</p>
                            <p><img src="../../assets/jigou.png" alt="">机构地址：{{jgdetail.address}}
                            </p>
                        </div>
                    </div>
                    <div class="qy_detailbodytitle yyzztt">
                        <span><i></i>营业执照</span>
                    </div>
                    <div class="zhengshulist">
                        <img :src="jgdetail.businessLicence|filtersImg" alt="">
                    </div>
                    <div class="shenhecz">
                        <div class="shenhetongguo mr10 cur" @click="mechanismupdateType">
                            审核通过
                        </div>
                        <div class="shenhetongguo bgred cur" @click="mechanismdelList">
                            删除记录
                        </div>
                    </div>
                </div>
            </div>
            <div v-show="isdelete" class="mask"></div>
            <div v-show="isdelete" class="delete_sai delete_flex_start">
                <div class="delete_sai_body shenqingsuccess">
                    <div class="delete_sai_body2 delete_jiaoan">
                    <span class="isdeleteja">
                            已删除
                    </span>
                        <div class="deletequre cur" @click="golisting">
                            确认
                        </div>
                    </div>
                </div>
<!--                <i class="el-icon-circle-close cur" @click="delete_fun"></i>-->
            </div>
            <div v-show="issuccess" @click="success_fun" class="mask"></div>
            <div v-show="issuccess" class="delete_sai delete_flex_start">
                <div class="delete_sai_body shenqingsuccess">
                    <div class="delete_sai_body2 delete_jiaoan">
                    <span class="isdeleteja">
                            提交申请成功！！可在首页中查看<br>教练相关信息
                    </span>
                    </div>
                </div>
                <i class="el-icon-circle-close cur" @click="success_fun"></i>
            </div>
        </div>
    </div>
</template>

<script>
    import PlatformCrumb from "@/components/PlatformCrumb.vue";
    import { mechanismget, mechanismdelList, mechanismupdateType} from '../../api/api/platform.js';
    import {baseImgPath, basefile} from '@/config/env.js';

    export default {
        components: {
            PlatformCrumb
        },
        data() {
            return {
                id: this.$route.query.id,
                data: {
                    id: this.$route.query.id
                },
                isshow: false,
                jgdetail: {
                    "id": 0,
                    "userId": 29,
                    "name": "",
                    "addressInfo": "",
                    "address": "",
                    "leaderName": "",
                    "leaderPhone": "",
                    "phone": "",
                    "leaderNo": "",
                    "weChatNo": "",
                    "mail": "",
                    "type": 0,
                    "status": 0,
                    "createTime": 1560584128000,
                    "updateTime": 1560584128000,
                    "reason": null,
                    "passTime": null,
                    "homeImgs": null,
                    "businessLicence": null,
                    "logoImg": null,
                    "banner": null,
                    "info": null,
                    "trainingFacilities": null,
                    "trainingVideo": null,
                    "message": null,
                    "courses": null,
                    "teams": null,
                    "matchs": null,
                    "publicName": null,
                    "publicImg": null,
                    "infoAddress": null,
                    "infoPhone": null,
                    "infoMail": null
                },
                page: {
                    "coachId": this.$route.query.id,
                    "pageNum": 1,
                    "pageSize": 10
                },
                list: [],
                isdelete: false,
                issuccess: false,
                ids: {
                    ids: []
                }
            };
        },
        created() {
            this.handleClick()
            this.mechanismget()
        },
        methods: {
            handleClick() {
                this.ids.ids = []
                this.ids.ids.push(this.id)
            },
            delete_fun() {
                this.isdelete = !this.isdelete
            },
            success_fun() {
                this.issuccess = !this.issuccess
            },
            golisting(){
                var that = this;
                that.$router.push({
                    path: '/platform/listing',
                })
            },
            deletelistClick() {
                var that = this;
                console.log(that.ids.ids);
                if (that.ids.ids.length > 0) {
                    this.mechanismdelList()
                } else {
                    this.$message.error('还没有选择记录');
                }
            },

            // 删除记录
            mechanismdelList() {
                var that = this;
                // that.delete_fun()
                mechanismdelList(that.ids).then(res => {
                    if (res.code == 200) {
                        that.delete_fun()
                    }
                });
            },
            // 审核记录
            mechanismupdateType() {
                var that = this;
                // that.success_fun()
                mechanismupdateType(that.ids).then(res => {
                    if (res.code == 200) {
                        that.success_fun()
                    }
                });
            },
            updatelistClick() {
                var that = this;
                console.log(that.ids.ids);
                if (that.ids.ids.length > 0) {
                    this.mechanismupdateType()
                } else {
                    this.$message.error('还没有选择记录');
                }
            },
            // 获取详情
            mechanismget() {
                var that = this;
                mechanismget(this.data).then(res => {
                    if (res.code == 200) {
                        that.jgdetail = res.data
                    }
                });
            }
            ,
        },
        filters: {
            filtersImg: function (img) {
                return basefile + img
            },
        },
    };
</script>

<style lang="less" scoped>
    @import url("platform.less");

    .operation {
        margin-right: 25px;
    }
</style>
